package parser;

import util.XMFishParsers;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class XMFishParser implements Parser{
    @Override
    public List<Content> parser(String html, Properties properties) {
        List<Content> contentList;

        List<String> urlList = new ArrayList<>();

        Pattern pattern = Pattern.compile("http://bbs\\.xmfish\\.com/thread-htm-fid-\\d{1,3}\\.html");
        Matcher matcher = pattern.matcher(html);

        while (matcher.find()){
            urlList.add(matcher.group());
        }

        contentList = XMFishParsers.parse(urlList, properties);

        return contentList;
    }
}
